package runthrad;

import javax.xml.bind.DatatypeConverter;
import java.util.ArrayList;

/**
 * 测试多线程返回值
 * @author DELL
 * @create 2017-09-19 14:14
 */
public class TestReturnValue {
    public static void main(String[] args) {
        ArrayList<String> files = new ArrayList<>();
        files.add("src/file/file.txt");
        files.add("src/file/file2.txt");
        files.add("src/file/file3.txt");
        for (String filename : files) {
            //计算摘要
            DigestThread dr = new DigestThread(filename);
            dr.start();

            //现在显示结果
            StringBuilder result = new StringBuilder(filename);
            result.append(": ");
            byte[] digest = dr.getDigest();
            result.append(DatatypeConverter.printHexBinary(digest));
            System.out.println(result);
        }
    }
}
